﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WarsKeyChanger
{
    public class WarsKeyConfig
    {
        protected string SectionName {get; private set;}
        protected IniFileInfo ConfigFileInfo { get; private set; }
        public WarsKeyConfig(string configFilePath,string sectionName)
        {
            ConfigFileInfo = new IniFileInfo(configFilePath);
            SectionName = sectionName;
        }

        public Keys this[Keys hotKey]
        {
            //get
            //{
            //    var hotKeyValue = ConfigFileInfo.GetSectionKeyValue(this.SectionName, hotKey.ToString());
            //    if (string.IsNullOrEmpty(hotKeyValue))
            //    {
            //        ConfigFileInfo.SetSectionKeyValue(this.SectionName, hotKey.ToString(), (((int)hotKey)).ToString());
            //        return Keys.NumPad1;
            //    }
            //    else
            //    {
            //        return (Keys)int.Parse(hotKeyValue);
            //    }
            //}

            set
            {
                ConfigFileInfo.SetSectionKeyValue(this.SectionName, hotKey.ToString(), (((int)value)).ToString());
            }
        }
    }
}
